package BookManage;



import BookManage.dao.*;
import BookManage.dao.Impl.BookManageDaoImpl;

import java.util.List;
import java.util.Scanner;

public class main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        BookManageDao bookManageDao=new BookManageDaoImpl();
        boolean sf=true;
        do {
            System.out.println("请输入：");
            int xz=in.nextInt();
            switch (xz){
                case 1:
                    List<BookManage> list=bookManageDao.list(1,2);
                    for(BookManage bookManage:list){
                        System.out.print(bookManage.getId()+" ");
                        System.out.print(bookManage.getName()+" ");
                        System.out.print(bookManage.getAuthor()+" ");
                        System.out.print(bookManage.getDate()+" ");
                        System.out.print(bookManage.getType()+" ");
                        System.out.println();
                    }
                    break;
                case 2:
                    System.out.println("请输入要删除的：");
                    String id=in.next();
                    bookManageDao.sc(id);
                    break;
                case 3:
                    System.out.println("请输入姓名：");
                    String name=in.next();
                    System.out.println("请输入作者：");
                    String zz=in.next();
                    System.out.println("请输入时间：");
                    String date=in.next();
                    System.out.println("请输入类别：");
                    String type=in.next();
                    BookManage manage=new BookManage(-1,name,zz,date,type);
                    bookManageDao.xz(manage);
                    break;
                case 4:
                    System.out.println("输入要修改的id：");
                    int id1=in.nextInt();
                    System.out.println("请输入姓名：");
                    String name1=in.next();
                    System.out.println("请输入作者：");
                    String zz1=in.next();
                    System.out.println("请输入时间：");
                    String date1=in.next();
                    System.out.println("请输入类别：");
                    String type1=in.next();
                    BookManage manage1=new BookManage(id1,name1,zz1,date1,type1);
                    bookManageDao.xg(manage1);
                    break;
            }
        }while (sf);
    }
}
